<template>
  <div class="container">
    <div>
      <ul>
        <li>
          工作人员勾选一个派工单进行报工，上面可以由工序和产品的查询条件
        </li>
        <li>
          这里委外工单，就是委外的派工单，在工艺时勾选了委外，委外派工单不能和正常派工单一块在报工台显示，由专门的菜单展示<br />
          委外接受就是委外委外派单报工，报工人写供应商即可。
        </li>
      </ul>

      <a-table :bordered="{cell:true}" :pagination="false" stripe :data="state.entityObj">
        <template #columns>
          <a-table-column title="派工人" data-index="createuser"></a-table-column>
          <a-table-column title="贸易号" data-index="myh"></a-table-column>
          <a-table-column title="任务通知单号" data-index="taskno"></a-table-column>
          <a-table-column title="料品名称" data-index="lpmc"></a-table-column>
          <a-table-column title="产品标识号" data-index="cpm"></a-table-column>
          <a-table-column title="生产重量" data-index="sczl"></a-table-column>
          <a-table-column title="已完工重量" data-index="wgcl"></a-table-column>
          <a-table-column title="工序" data-index="gx"></a-table-column>
          <a-table-column title="操作" width="250">
            <template #cell="{ record }">
              <a-space>
                <a-button type="primary" size="small" @click="bgEntity"><template #icon><icon-edit /></template>报工</a-button>
                <a-button type="primary" size="small" status="warning" @click="changeEntity"><template #icon><icon-edit /></template>变料拆分</a-button>
              </a-space>
            </template>
          </a-table-column>
        </template>
      </a-table>

      <a-modal title="报工填写" v-model:visible="state.entityBgVisible" :footer="false" width="1380px">
        <BgDetail v-if="state.entityBgVisible" v-model="state.entityBgVisible"></BgDetail>
      </a-modal>
      <a-modal title="报工填写" v-model:visible="state.entityChangeVisible" :footer="false" width="1380px">
        <BlDetail v-if="state.entityChangeVisible" v-model="state.entityChangeVisible"></BlDetail>
      </a-modal>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { Message } from '@arco-design/web-vue'
import {reactive, ref, onMounted, onUnmounted, defineAsyncComponent} from "vue";
import { useRouter } from "vue-router";

const BgDetail = defineAsyncComponent(() => import('@/views/product/pgd/bgDetail.vue'));
const BlDetail = defineAsyncComponent(() => import('@/views/product/pgd/blDetail.vue'));

const state = reactive({
  entityObj: [],
  entityBgVisible : false,
  entityChangeVisible : false
})
const loadList = ()=>{
  state.entityObj = [
    {id : 1,createuser:'王恩咸',myh:'贸2025-001', taskno : '2025-BC-0001',lpmc:'H13', cpm:'H13-250011', sczl:'25.2T', wgcl:'15.2T', gx:'下料'},
    {id : 2,createuser:'王恩咸',myh:'贸2025-002', taskno : '2025-BC-0001',lpmc:'H15', cpm:'H15-250015', sczl:'15.3T', wgcl:'10.3T', gx:'下料'},
    {id : 3,createuser:'王恩咸',myh:'贸2025-001', taskno : '2025-BC-0001',lpmc:'H13', cpm:'H13-250011-1', sczl:'25.2T', wgcl:'0T', gx:'下料'},
    {id : 4,createuser:'王恩咸',myh:'贸2025-002', taskno : '2025-BC-0001',lpmc:'H15', cpm:'H15-250015', sczl:'15.3T', wgcl:'0T', gx:'下料'},
    {id : 5,createuser:'常乐',myh:'贸2025-001', taskno : '2025-BC-0001',lpmc:'H13', cpm:'H13-250011-2', sczl:'25.2T', wgcl:'0T', gx:'下料'},
    {id : 6,createuser:'常乐',myh:'贸2025-002', taskno : '2025-BC-0001',lpmc:'H15', cpm:'H15-250015', sczl:'15.3T', wgcl:'0T', gx:'下料'},
  ]
}
const bgEntity = ()=>{
  state.entityBgVisible = true
}
const changeEntity = ()=>{
  state.entityChangeVisible = true
}
onMounted(()=>{
  loadList();
})
onUnmounted(()=>{
})
</script>

<style scoped lang="less">
ul{
  color: #f60000; font-weight: bold;font-size: 16px;
  li{
    padding : 10px;
  }
}
</style>
